package com.ymatou.iapi.liveseller.testcase;

import java.util.Map;
import java.util.Random;

import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.ymatou.iapi.liveseller.parameter.CreateSellerLiveBean;
import com.ymatou.iapi.liveseller.parameter.LiveDto;
import com.ymatou.iapi.liveseller.service.CreateSellerLiveCall;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderService;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.business.service.LiveRoomCallService;
import com.ymttest.database.model.LiveRoom;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.LiveRoomWapper;
import com.ymttest.utils.DesUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * 创建互动直播 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_CreateSellerLive {
	private static CreateSellerLiveBean createsellerliveBean;
	private static CreateSellerLiveCall createsellerliveCall;
	private static LiveRoomWapper liveRoomWapper;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建互动直播");
	}

	@Before
	public void caseUp() {
		createsellerliveBean = new CreateSellerLiveBean();
		createsellerliveCall = new CreateSellerLiveCall();
		liveRoomWapper = new LiveRoomWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(createsellerliveCall.getOpurl());
		liveRoomWapper = null;
	}

	@After
	public void caseDown() {

		Logger.end();
	}

	private void verifyDB(LiveRoom livedto, int liveid) throws Exception {
		Logger.comment("数据库验证");
		LiveRoom dblive = liveRoomWapper.selectLiveRoomById(liveid);
		Logger.verifyEquals(livedto.getCountryId(), dblive.getCountryId(), "验证CountryId");
		Logger.verifyEquals(livedto.getEndTime(), dblive.getEndTime().substring(0, 19), "验证EndTime");
		Logger.verifyEquals(livedto.getGroupId(), dblive.getGroupId(), "验证GroupId");
		Logger.verifyEquals(livedto.getStartTime(), dblive.getStartTime().substring(0, 19), "验证StartTime");
		Logger.verifyEquals(livedto.getLatitude(), dblive.getLatitude(), "验证Latitude");
		Logger.verifyEquals(livedto.getLongitude(), dblive.getLongitude(), "验证Longitude");
		Logger.verifyEquals(livedto.getLiveAddress(), dblive.getLiveAddress(), "验证LiveAddress");
		Logger.verifyEquals(livedto.getLiveCover(), dblive.getLiveCover(), "验证LiveCover");
		Logger.verifyEquals(livedto.getLiveTitle(), dblive.getLiveTitle(), "验证LiveTitle");
		Logger.verifyEquals(livedto.getShoppingAddress(), dblive.getShoppingAddress(), "验证ShoppingAddress");
		Logger.verifyEquals(livedto.getPreVideoHeight(), dblive.getPreVideoHeight(), "验证PreVideoHeight");
		Logger.verifyEquals(livedto.getPreVideoLength(), dblive.getPreVideoLength(), "验证PreVideoLength");
		Logger.verifyEquals(livedto.getPreVideoPic(), dblive.getPreVideoPic(), "验证PreVideoPic");
		Logger.verifyEquals(livedto.getPreVideoWidth(), dblive.getPreVideoWidth(), "验证PreVideoWidth");
		Logger.verifyEquals(livedto.getSellerName(), dblive.getSellerName(), "验证SellerName");
		Logger.verifyEquals(livedto.getUserId(), dblive.getUserId(), "验证UserId");
		Logger.verifyEquals(livedto.getPreVideoUrl(), dblive.getPreVideoUrl(), "验证PreVideoUrl");
		Logger.verifyNotNull(dblive.getPushUrl(), "验证PushUrl");
		String pushurl = DesUtil.decrypt(dblive.getPushUrl(), DesUtil.DES_KEY_STRING, DesUtil.DES_IVPARAMETER);
		Map mpush = FormatUtil.httpStringToMap(pushurl.split("\\?")[1]);
		String sourcepushsecret = LiveRoomCallService.LiveAntiKey + LiveRoomCallService.BizId + "_" + EnvSetup.getEnv().toUpperCase() + "_" + liveid
				+ mpush.get("txTime").toString();
		String pushtxsecret = TestDataManager.getMD5(sourcepushsecret.getBytes());
		Logger.verifyEquals(mpush.get("txSecret").toString(), pushtxsecret, "验证pushtxsecret");
		// rtmp://11418.livepush.myqcloud.com/live/11418_52?txSecret=80747057322436595a4aaf0b1cb3d71a&txTime=59EAEEE1
		Logger.verifyNotNull(dblive.getPlayUrl(), "验证PlayUrl");
		// String
		// playUrl=DesUtil.decrypt(dblive.getPlayUrl(),DesUtil.DES_KEY_STRING,DesUtil.DES_IVPARAMETER);
		// Map mplay=FormatUtil.httpStringToMap(playUrl.split("\\?")[1]);
		// String
		// playtxsecret=TestDataManager.getMD5(sourcepushsecret.getBytes());
		// Logger.verifyEquals(mplay.get("txSecret").toString(), playtxsecret,
		// "验证pushtxsecret");
		// rtmp://11418.liveplay.myqcloud.com/live/11418_52?txSecret=80747057322436595a4aaf0b1cb3d71a&txTime=59EAEEE1
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_001() {
		Logger.start(true, "创建互动直播成功");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("200", createsellerliveCall.getString("Code"), "验证Code");
			JsonObject data = createsellerliveCall.getJsonObject().get("Data").getAsJsonObject();
			Logger.verifyEquals(true, data.get("Result").getAsBoolean(), "验证Result");
			verifyDB(createsellerliveBean.getLiveDto(), data.get("LiveId").getAsInt());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_002() {
		Logger.start(true, "不输入userid失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setUserId(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyIsContains("买手Id不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_003() {
		Logger.start(true, "不输入LiveTitle失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setLiveTitle(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("标题不能为空", createsellerliveCall.getString("Msg"), "验证Msg");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_004() {
		Logger.start(true, "创建互动直播成功,标题包含特殊字符");
		try {
			// sql添加：set names utf8mb4;
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			createsellerliveBean.getLiveDto().setLiveTitle("测试特殊字符;😑😊😳");
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("200", createsellerliveCall.getString("Code"), "验证Code");
			JsonObject data = createsellerliveCall.getJsonObject().get("Data").getAsJsonObject();
			Logger.verifyEquals(true, data.get("Result").getAsBoolean(), "验证Result");
			verifyDB(createsellerliveBean.getLiveDto(), data.get("LiveId").getAsInt());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_005() {
		Logger.start(true, "开始时间早于当前时间失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextMunite(-100));
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_006() {
		Logger.start(true, "结束时间早于开始时间失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextMunite(-100));
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("直播结束时间必须大于开始时间", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_007() {
		Logger.start(true, "开始时间晚于30天失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextDay(31));
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextDay(32));
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("直播开始时间最多只能设置为30天之内", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_008() {
		Logger.start(true, "标题长度小于18互动直播创建失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setLiveTitle("Test");
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyIsContains("直播名称长度需在", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_009() {
		Logger.start(true, "标题长度小大于36互动直播创建失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setLiveTitle("测试标题长度大于三十六的情况试试这样能否创建");
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyIsContains("直播名称长度需在", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_010() {
		Logger.start(true, "直播时间大于4小时失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextMunite(10));
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextMunite(60 * 4 + 11));
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("直播时间不能大于4小时", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_011() {
		Logger.start(true, "重复创建互动直播失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			createsellerliveCall.callService();
			Logger.verifyEquals("201", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyIsContains("不可重复创建", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_012() {
		Logger.start(true, "创建2个未来的互动直播失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextMunite(220));
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextMunite(300));
			createsellerliveCall.callService();
			Logger.verifyEquals("201", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("即将开始直播只能创建一场，不可重复创建", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_013() {
		Logger.start(true, "正在直播推流的直播时创建一个未来的互动直播成功");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(createsellerliveBean);
			LiveRoomCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			createsellerliveBean.getLiveDto().setGroupId(String.valueOf(YMTDateUtil.getDate().getTime()));
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextMunite(220));
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextMunite(300));
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			JsonObject data = createsellerliveCall.getJsonObject().get("Data").getAsJsonObject();
			Logger.verifyEquals("200", createsellerliveCall.getString("Code"), "验证Code");
			verifyDB(createsellerliveBean.getLiveDto(), data.get("LiveId").getAsInt());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_014() {
		Logger.start(true, "不输入PreVideoPic失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setPreVideoPic(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("预告短片封面不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_015() {
		Logger.start(true, "不输入PreVideoUrl失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setPreVideoUrl(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("预告短片不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_016() {
		Logger.start(true, "不输入LiveAddress失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setLiveAddress(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("直播地不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_017() {
		Logger.start(true, "不输入StartTime失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setStartTime(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("开始时间不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_CreateSellerLive_018() {
		Logger.start(true, "不输入EndTime失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			createsellerliveBean.getLiveDto().setEndTime(null);
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("结束时间不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_019() {
		Logger.start(true, "groupid为空失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveBean.getLiveDto().setGroupId(null);
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("400", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyIsContains("不能为空", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_020() {
		Logger.start(true, "直播1已经开始,第二个互动直播开始时间在这个结束时间之前失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(createsellerliveBean);
			LiveRoomCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextMunite(80));
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextMunite(300));
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("201", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("此时间段已存在直播，不可重复创建", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_021() {
		Logger.start(true, "直播1未开始但是到了开始时间,第二个互动直播开始时间在这个结束时间之前");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(createsellerliveBean);
			// LiveRoomCallService.SellerLiveOnline(createlive.getId(),
			// createlive.getUserId());
			LiveRoomCallService.UpdateLiveTimeToStart(createlive.getId());
			createsellerliveBean.getLiveDto().setGroupId(String.valueOf(YMTDateUtil.getDate().getTime()));
			createsellerliveBean.getLiveDto().setStartTime(YMTDateUtil.getBeforeOrNextMunite(2000));
			createsellerliveBean.getLiveDto().setEndTime(YMTDateUtil.getBeforeOrNextMunite(2100));
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			Logger.verifyEquals("200", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyEquals("操作成功", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_CreateSellerLive_022() {
		Logger.start(true, "groupid重复，失败");
		try {
			createsellerliveBean = LiveRoomCallService.initCreatesellerliveBean(null);
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			createsellerliveBean.setRequestId(TestDataManager.getRandomUUID().toString());
			createsellerliveCall.setData(createsellerliveBean);
			createsellerliveCall.callService();
			LiveRoomCallService.AutoCloseLiveRoomByUserId(createsellerliveBean.getLiveDto().getUserId());
			createsellerliveCall.callService();
			Logger.verifyEquals("500", createsellerliveCall.getString("Code"), "验证Code");
			Logger.verifyIsContains("系统异常", createsellerliveCall.getString("Msg"), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}